package com.cskaoyan.controller.wx_topic;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.bo.wx_topic.WxTopicListBO;
import com.cskaoyan.bean.vo.wx_topic.WxTopicDetailVO;
import com.cskaoyan.bean.vo.wx_topic.WxTopicListVO;
import com.cskaoyan.bean.vo.wx_topic.WxTopicRelatedVO;
import com.cskaoyan.service.wx_topic.WxTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 冯子靖
 * @Description:
 * @Date: 2022/7/21 10:51
 */
@RestController
@RequestMapping("wx/topic")
public class WxTopicController {
    @Autowired
    WxTopicService wxTopicService;

    @GetMapping("list")
    public BaseRespVo printTopicList(WxTopicListBO wxTopicListBO) {
        WxTopicListVO wxTopicListVO = wxTopicService.printTopicList(wxTopicListBO);
        return BaseRespVo.ok(wxTopicListVO);
    }

    @GetMapping("detail")
    public BaseRespVo printTopicDetail(Integer id) {
        WxTopicDetailVO wxTopicDetailVO = wxTopicService.printTopicDetail(id);
        return BaseRespVo.ok(wxTopicDetailVO);
    }

    /**
     * 接口说明:前段没有发送分页需要的数据请求数据,也没有实现分页,所以对后端进行改进,与实际效果有出入
     * @param id
     * @return
     */
    @GetMapping("related")
    public BaseRespVo printTopicRelated(Integer id) {
        WxTopicRelatedVO wxTopicRelatedVO = wxTopicService.printTopicRelated(id);
        return BaseRespVo.ok(wxTopicRelatedVO);
    }
}
